package com.utils;

import org.apache.commons.lang3.ArrayUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author yuanzheng
 * @version 1.0
 * @since 2020-12-24
 */
public class GsmDataCreateUtils {

    public static String getGsmRecord(int i) {
        //手机号数量
        int mobileCount = 5000000;
        //设备数量
        int ipCount = 500;
        //生成数据的数量
        int dataCount = 100000000;
        //获取手机号信息
        //List<Map> listMobile = getMobile(mobileCount);
        //获取设备信息
        //List<Map> listIp = getip(ipCount);
        int ip = (int) (Math.random() * ipCount);
        return (210416000000000L + i) + "," + (460000000000000L + i) + "," + (860000000000000L + i) + "," + ip + ",河南省郑州市中原区金属西路第" + ip + "号";

    }

    /**
     * 获取设备数据
     *
     * @param count
     * @return
     */
    public List<Map> getip(int count) {
        List<Map> list = new ArrayList<Map>();
        for (int i = 0; i < count; i++) {
            list.add(ArrayUtils.toMap(new String[][]{
                    {"ip", String.valueOf(i)},
                    {"location", "河南省郑州市中原区金属西路第" + i + "号"},
            }));
        }
        return list;
    }

    /**
     * 获取count个手机信息
     *
     * @param count
     * @return
     */
    public List<Map> getMobile(int count) {
        List<Map> list = new ArrayList<Map>();
        long mobile = 13000000000L;
        long imsi = 460000000000000L;
        long imei = 860000000000000L;
        for (int i = 0; i < count; i++) {
            list.add(ArrayUtils.toMap(new String[][]{
                    {"imsi", String.valueOf(imsi + i)},
                    {"imei", String.valueOf(imei + i)},
                    {"mobile", String.valueOf(mobile + i)},
                    {"attribution", String.valueOf((int) (Math.random() * 1000))}
            }));
        }
        return list;
    }


}



